<?php
/* @var $this StkProductoController */
/* @var $model StkProducto */
/* @var $form CActiveForm */
?>
<script type="text/JavaScript">
	//$('body').css('background', '#fff');
</script>
<div class="form">
<div id="content2">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'Stk-producto-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
        'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions'=>array(
        'validateOnSubmit'=>true,
        )
)); ?>

	<p class="note">Los campos marcados <span class="required">*</span> son requeridos.</p>

	<?php echo $form->errorSummary($model); ?>
       
	<div class="row">
		<?php if($model->Nombre=="")
				{ ?>
					<?php echo $form->textField($model,'Nombre',array('size'=>60,'maxlength'=>200, 'class'=>'formulary_contact',  'value'=>'Nombre Producto','onblur'=>"if (this.value=='') this.value = 'Nombre Producto'", 'onfocus'=>"if (this.value=='Nombre Producto') this.value = ''",)); ?>
		<?php } else{ ?>
					<?php echo $form->textField($model,'Nombre',array('size'=>60,'maxlength'=>200, 'class'=>'formulary_contact')); ?>
		<?php } ?>
		<?php echo $form->error($model,'Nombre'); ?>
	</div>

	<div class="row">
		<?php if($model->Codigo==""){?>
		<?php echo $form->textField($model,'Codigo',array('size'=>60,'maxlength'=>100, 'class'=>'formulary_contact',  'value'=>'Codigo','onblur'=>"if (this.value=='') this.value = 'Codigo'", 'onfocus'=>"if (this.value=='Codigo') this.value = ''",)); ?>
		<?php }
			else{?>
			<?php echo $form->textField($model,'Codigo',array('size'=>60,'maxlength'=>100, 'class'=>'formulary_contact')); ?>
			<?php
			}?>
		<?php echo $form->error($model,'Codigo'); ?>
	</div>

	<script src="<?php echo Yii::app()->baseUrl.'/ckeditor/ckeditor.js'; ?>"></script>
       
	<div class="row">
		<?php echo $form->labelEx($model,'Texto'); ?>
		 <?php echo $form->textArea($model, 'Texto', array('id'=>'Texto')); ?>
		<?php echo $form->error($model,'Texto'); ?>
	</div>
	<script type="text/javascript">
		CKEDITOR.replace( 'Texto',
		{
			filebrowserBrowseUrl : '/browser/browse.php',
			
		});
                
	</script>

        <script src="<?php echo Yii::app()->baseUrl.'/ckeditor/ckeditor.js'; ?>"></script>

	<div class="row">
		<?php echo $form->labelEx($model,'Resumen'); ?>
		 <?php echo $form->textArea($model, 'Resumen', array('id'=>'Resumen')); ?>
		<?php echo $form->error($model,'Resumen'); ?>
	</div>
	<script type="text/javascript">
		CKEDITOR.replace( 'Resumen' );
                
	</script>
	<div class="row">
		<?php if($model->Orden ==""){ ?>
			<?php echo $form->textField($model,'Orden',array('size'=>60, 'class'=>'formulary_contact',  'value'=>'Orden','onblur'=>"if (this.value=='') this.value = 'Orden'", 'onfocus'=>"if (this.value=='Orden') this.value = ''",)); ?>
		<?php }else{ ?>
			<?php echo $form->textField($model,'Orden',array('size'=>60, 'class'=>'formulary_contact')); ?>
		<?php } ?>
		<?php echo $form->error($model,'Orden'); ?>
	</div>
	<div class="row">
		<?php $user=StkUsuario::model()->find('LOWER(NombreUsuario)=?',array( Yii::app()->user->name)); ?>
		<?php echo $form->hiddenField($model,'Usuario_Id',array('type'=>"hidden",'readonly'=>"readonly", 'value'=>$user->id)); ?>
		<?php echo $form->error($model,'Usuario_Id'); ?>
	</div>

        <div class="row">
		<?php echo $form->labelEx($model,'Categoria_Id'); ?>
		<?php echo $form->dropDownList($model,'Categoria_Id',CHtml::listData(StkCategoria::model()->findAll(),'Id','Nombre'),array('empty'=>'Seleccione')); ?>
		<?php echo $form->error($model,'Categoria_Id'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar', array('class'=>'comment')); ?>
	</div>

<?php $this->endWidget(); ?>
</div>
</div><!-- form -->